package com.joysuch.wwyt.bp.repository;

import com.joysuch.wwyt.bp.entity.risk.BpCompany;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.query.Param;

import java.time.LocalDate;
import java.util.List;

/**
 * @Author ZhangDong
 * @Date 2020/3/16 11:16
 */
public interface BpCompanyRepository extends JpaRepository<BpCompany, Long>, JpaSpecificationExecutor<BpCompany> {

    List<BpCompany> findByAnnounceTime(LocalDate announceTime);

    List<BpCompany> findByAnnounceStatusNotAndAnnounceTimeLessThan(@Param("announceStatus") String announceStatus,
                                                                   @Param("announceTime") LocalDate announceTime);

    List<BpCompany> findByAnnounceTimeAndAnnounceStatus(@Param("announceTime") LocalDate announceTime,
                                                        @Param("announceStatus") String announceStatus);

    int countByAnnounceStatusAndAnnounceTime(String announceStatus, LocalDate announceTime);

    List<BpCompany> findByAnnounceStatus(String announceStatus);
}
